PHP7.4报错getimagesize(): SSL operation failed with code 1问题
完整错误信息
Warning: getimagesize(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
解决方法一
先下载cacert.pem证书,https://curl.se/ca/cacert.pem,下载完后我直接上传到了/www/server/php目录下
找到对应的php版本的php.ini文件
将openssl.cafile其路径替换为openssl.cafile=/www/server/php/cacert.pem也就是你刚上传的cacert.pem证书路径
最后重启php服务即可
解决方法二
$url = "https://www.zc10.cn/1.jpg";
$url = str_replace("https://", "http://", $url);
$url = trim($url);
$Info = getimagesize($url);